package ltd.bean;

import com.fasterxml.jackson.core.JsonParser.Feature;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Jackson 的Mapper类
 * @author chinalin
 */
public class JacksonMapper {
	
	private static final ObjectMapper mapper = new ObjectMapper();
	
	private JacksonMapper() {
		super();
		//该特性决定parser是否允许JSON字符串包含非引号控制字符（值小于32的ASCII字符，包含制表符和换行符）。 默认属性关闭，遇到这些字符，则会抛出异常。
        mapper.configure(Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
	}
	
	/**
	 * 获取Jackson的Mapper对象
	 */
	public static ObjectMapper getMapper() {
		return mapper;
	}

}
